Core Systems topic

Core Systems

For convienence you have access to all core systems of Bullseye2D via global getters.

Here is an example of how you can access various subsystems from anywhere in your code that imports Bullseye2D.

class MySprite {
  var position = Vector2();
 
  late Image sprite;
  late Sound engineFX;
 
  MySprite() {
    sprite = resouces.loadImage("mySprite.png");
    engineFx = resources.loadSound("mySound.wav");
  }

  void update() {
    if (keyboard.keyHit(KeyCodes.W)) {
      position.y -= 4;
    }
  }

  void render() {
    audio.playSound(engineFX);    
    gfx.drawImage(sprite, 0, position.x, position.y);
  }
}

Properties

accel Accelerometer Core Systems
{@category Core_Systems} Provides access to the device's accelerometer data.
no setter
audio Audio Core Systems
{@category Core_Systems} Manages audio playback for sounds and music.
no setter
gamepad Gamepad Core Systems
{@category Core_Systems} Handles gamepad input from connected controllers.
no setter
gfx Graphics Core Systems
{@category Core_Systems} The main graphics interface for rendering 2D primitives, textures, and text.
no setter
keyboard Keyboard Core Systems
{@category Core_Systems} Manages keyboard input.
no setter
loader Loader Core Systems
{@category Core_Systems} Manages the loading of game assets.
no setter
mouse Mouse Core Systems
{@category Core_Systems} Manages mouse and touch input.
no setter
resources ResourceManager Core Systems
{@category Core_Systems} Manages loading and caching of game resources like textures, fonts, and sounds.
no setter